<template>
  <div class="students-wrapper page-wrapper">
    <div class="container">
      <div class="students-list">
        <h3>Alumnus 优秀校友</h3>
        <div class="students-container">
          <div class="students-instance" v-for="item in alumnsList" :key="item.id">
             <div class="text">
              <div class="name">{{item.name}}</div>
              <div class="direction">{{item.work_company}}</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator';
import { RequestStatus } from '../utils/constans';
import { formatBackTime } from '../utils/common';
import { iAlumnus } from '../typings/students';
import $api from '../api';

@Component
export default class StudnetsView extends Vue {

  private alumnsList: iAlumnus[] = [];

  private mounted() {
    this.getAlumnusList();
  }

  private getAlumnusList() {
     $api.students.findAllAlumnusClient()
    .then((res) => {
      const alumnsList: iAlumnus[] = [];
      (res as any).map( (record: iAlumnus) => {
        // to do
        alumnsList.push(record);
      });
      this.alumnsList = alumnsList;
    });
  }
}
</script>

<style lang="scss" scoped>
.students-wrapper{
  padding: 30px;
  .container{
    width: 1200px;
    margin: auto;
  }
  .students-wrapper{
    text-align: left;
  }
  .students-container{
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
  }
  .students-instance{
    width: 33.3%;
    position: relative;
    margin-bottom: 2px;
    background: white;
    box-sizing: border-box;
    border-right: 2px solid #198afa;
    &:nth-child(3n+2){
      border-color: #f5ae54;
    }
    .text{
        padding: 20px 0;
      .name{
        font-size: 18px;
        font-weight: bold;
        color: #113f6c;
      }
      .direction{
        margin-top: 10px;
      }
    }
  }
}
@media screen and (max-width: 1200px){
    .students-wrapper{
      .students-instance{
        width: 48%;
        &:nth-child(3n+2){
          border-color: #198afa;
        }
        &:nth-child(2n+1){
          border-color: #f5ae54;
        }
      }
    }
}
@media screen and (max-width: 640px){
  .students-wrapper{
      .students-instance{
          width: 49%;
         .img, .text{
            height: 160px;
          }
          .img{
            width: 120px;
          }
          .text{
            padding-left: 130px;
            padding-right: 10px;
          }
      }
  }
}
</style>